package com.mediacloud.app.newsmodule.fragment.navlive

import android.util.Log
import com.alibaba.fastjson.JSON
import com.mediacloud.app.model.news.ArticleListData
import org.json.JSONObject

class NavLiveData : ArticleListData() {

    var weekList: List<NavDateItem>? = null
    var navigate: HashMap<String, Any>? = null
        private set

    override fun readFromJson(data: JSONObject?) {
        super.readFromJson(data)
        if (state) {

            var week = data?.optJSONObject("data")?.optJSONArray("week")
            weekList = JSON.parseArray("" + week, NavDateItem::class.java)


            val nav = data?.optJSONObject("data")?.optJSONObject("navigate")
            Log.v(TAG,"navigate$nav")
            if (nav != null)
                navigate = HashMap()
            val so = nav!!.optJSONObject("style_other")
            if (so != null) {
                val hashMap = HashMap<String, String>()
                hashMap["radio_bitmap"] = so.optString("radio_bitmap")
                navigate!!["style_other"] = hashMap
//                navigate!!.plus(Pair("style_other", hashMap))
            }

        }

    }
}